<?php

namespace app\admin\validate\channel;
use think\validate;

class Channel extends Validate
{


    protected $rule =   [

        'name'  => ['require',],
        'dm'  => ['require','alpha','unique'=>'channel'],
        'type_id'  => ['require'],
        'img'  => ['require'],
        //'password'=>['require','confirm','length'=>'6,16','regex'=>'/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*()_.]+)$)^[\w~!@#$%^&*()_.]{8,16}$/'],
        'device'=>['require'],
        'pay_type'=>['require'],
        'pay_time'=>['require'],
    ];

    protected $message  =   [

        'name.require'      => ['code' => 4012, 'msg' => '通道名称不能为空'],
        'name.unique'      => ['code' => 4013, 'msg' => '通道名称已经存在'],
        'img.require'      => ['code' => 4014, 'msg' => '图片必填'],
        'dm.require'      => ['code' => 4018, 'msg' => '通道代码必填'],
        'dm.alpha'      => ['code' => 4018, 'msg' => '通道代码必须纯字母'],
        'dm.unique'      => ['code' => 4018, 'msg' => '通道代码已经存在'],
        'type_id.require'      => ['code' => 4019, 'msg' => '通道类型必选'],
        'pay_type.require'   => ['code' => 4015, 'msg' => '支付方式必填'],
        'device.require'   => ['code' => 4015, 'msg' => '设备必填'],
        'pay_time.require'    => ['code' => 4016, 'msg' => '订单超时时间必填'],
    ];

    // edit 验证场景定义
    public function sceneModify()
    {
        return $this->remove('dm',true)->remove('name','unique');
    }




}